package de.jowadroid.timekeeping.tempdata;

import java.util.ArrayList;
import java.util.List;

/**
 * Data container for the displaying data.
 * 
 * @author Johannes
 *
 */
public class DisplayingData {
	List<String[]> dataRows = new ArrayList<String[]>();
	private String displayingUnit;

	public DisplayingData(String displayingUnit) {
		this.displayingUnit = displayingUnit;
	}

	public List<String[]> getDataRows() {
		return dataRows;
	}

	public String getDisplayingUnit() {
		return displayingUnit;
	}

	/**
	 * Adds a data row but only if unit- and timeEntry is no empty string and
	 * not null
	 * 
	 * @param unitEntry
	 *            left hand column entry
	 * @param timeEntry
	 *            right hand column entry
	 */
	public void addDataRow(String unitEntry, String timeEntry) {
		if (unitEntry != null && !unitEntry.isEmpty() && timeEntry != null
				&& !timeEntry.isEmpty()) {
			String[] dataRow = new String[] { unitEntry, timeEntry };
			dataRows.add(dataRow);
		}
	}
}
